package com.zoro.barn.business.service.pp.business.projectproduct.mapper;

import com.zoro.barn.business.service.pp.business.product.entity.BarnProduct;
import com.zoro.barn.business.service.pp.business.project.entity.BarnProject;
import com.zoro.barn.business.service.pp.business.projectproduct.entity.BarnProjectProduct;
import com.zoro.barn.commons.db.annotations.MybatisMapper;

import java.util.List;

/**
 * @author zhaoxingwu
 */
@MybatisMapper
public interface BarnProjectProductMapper {

    void insertBatch(List<BarnProjectProduct> data);

    /**
     * get if there are any relationship between the project and the product
     *
     * @param projectId project id
     * @param productId product id
     * @return count
     */
    int hasProduct(String projectId, String productId);

    void delete(String projectId, String productId);

    void query(BarnProjectProduct product);

    List<BarnProduct> getByProject(String projectId);

    List<BarnProject> getByProduct(String productId);

    /**
     * 删除一个project的所有 product
     *
     * @param projectId project id
     */
    void deleteProducts(String projectId);


}
